package com.szbmyoubao.app.helper

import com.szbmyoubao.app.bean.web.WechatPayReq
import com.ellecity06.common.utils.ToastUtils
import com.tencent.mm.opensdk.modelpay.PayReq

/**
 * @author ellecity06
 * @time 2024/12/16 10:26
 * @des
 */
class PayHelper {
    companion object {
        @JvmStatic
        fun wechatPay(webPayReq: WechatPayReq) {
            if (!wxApi.isWXAppInstalled) {
                ToastUtils.show("请先安装微信！")
                return
            }
            val payReq = PayReq()
            payReq.appId = webPayReq.appid
            payReq.partnerId = webPayReq.partnerid
            payReq.prepayId = webPayReq.prepayid
            payReq.packageValue = webPayReq.packageValue
            payReq.nonceStr = webPayReq.noncestr
            payReq.timeStamp = webPayReq.timestamp
            payReq.sign = webPayReq.sign
            wxApi.sendReq(payReq)
        }
    }
}